package com.igs.muziapp;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

import com.igs.muziapp.surface.IRequest_View;
import com.igs.muziapp.view.Songinfo_table;

public class Songinfo implements IRequest_View {
	private View view;
	private Context context;

	private Songinfo_table mSonginfo_table;

	private RelativeLayout Rel_Titlebtn_Box;
	private RelativeLayout Rel_Context_box;

	private Button Btn_SelItem;
	private Button Btn_SelLv;

	public Songinfo(final Context context) {
		this.context = context;

		LayoutInflater mLi = LayoutInflater.from(context);
		view = mLi.inflate(R.layout.muzi_songinfo, null);

		Rel_Titlebtn_Box = (RelativeLayout) view.findViewById(R.id.RelativeLayout_Titlebtn_Box);
		Rel_Context_box = (RelativeLayout) view.findViewById(R.id.RelativeLayout_Content_Box);

		mSonginfo_table = new Songinfo_table(context);
		// Lin_Content_Box.addView(mSonginfo_table.getView());
		Rel_Context_box.addView(mSonginfo_table.getView());

		Btn_SelItem = (Button) view.findViewById(R.id.button_selitem);
		Btn_SelLv = (Button) view.findViewById(R.id.button_sellv);

		// 選擇項目
		Btn_SelItem.setOnClickListener(SelItem_Click);
		// 選擇級別
		Btn_SelLv.setOnClickListener(SelLv_Click);

	}

	// 按下歌曲分類的項目
	private Button.OnClickListener SelItem_Click = new Button.OnClickListener() {
		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
			Log.d("songinfo", "Btn_SelItem");
			AlertDialog.Builder builder = new AlertDialog.Builder(context);
			builder.setTitle("歌曲分類");
			builder.setItems(R.array.songinfo_itemname, new DialogInterface.OnClickListener() {

				@Override
				public void onClick(DialogInterface dialog, int which) {
					// TODO Auto-generated method stub
					Log.d("songinfo", "which:" + which);

				}
			});
			builder.show();

		}
	};
	// 按下歌曲類的級別
	private Button.OnClickListener SelLv_Click = new Button.OnClickListener() {
		@Override
		public void onClick(View v) {
			AlertDialog.Builder builder = new AlertDialog.Builder(context);
			// TODO Auto-generated method stub
			builder.setTitle("設定級別");
			builder.setItems(R.array.songinfo_itemlv, new DialogInterface.OnClickListener() {

				@Override
				public void onClick(DialogInterface dialog, int which) {
					// TODO Auto-generated method stub
					Log.d("songinfo", "which:" + which);

				}

			});
			builder.show();
		}

	};

	@Override
	public View getView() {
		// TODO Auto-generated method stub
		return view;
	}
}
